<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function fn(a,b){
            // 给 a 和 b 默认值 。
            var a = a || 1;
            var b = b || 2;
            console.log(a,b);   // 1 2
        }

        // fn(10,20) ; // a 和b 忘记传值 。
        fn(0,"");



        function fn(a=1,b=2){  // 设置 a 和b的默认参数
            console.log(a,b)    // 0 ""
        }

        fn(0,"");

        let [a=10,b=20,c=30] = [1,2];
        console.log(a,b,c);     // 1 2 30

        let {myname="张三",age=20,height="178cm"} = {myname:"李四",age:30};
        console.log(myname,age,height);     // 李四 30 178cm
    </script>
</body>
</html>